<style>
    a.price-btn {
        display: block;
        background-color: #333333;
        color: #fff;
        padding: 4px;
        text-align: center;
        text-transform: uppercase;
        font-size: 14px;
        margin-top: 8px;
    }
</style>
<div class="row">
    <div class="span3 border-right padding10 box-shadow">
        <script>
            function submitForm() {
                document.getElementById("Project").submit();
            }
            function refresh() {
                window.location = "/Projects";
            }
        </script>
        <?php
        echo $this->Form->create('Project', array(
            'novalidate' => true,
            'id' => 'Project'
        ));
        ?>
        <?php
        $fors = array('' => 'All','Sell' => 'Sell', 'Rent' => 'Rent','Sell&Rent' => 'Sell&Rent');
        ?>
 
        <div data-role="input-control" class="input-control select">
            <?php
            echo $this->Form->input('type_for', array(
                'options' => $fors,
                'default' => 'All',
                'label' => false,
                'onchange' => 'submitForm()'
            ));
            ?>
        </div>

        <div data-role="input-control" class="input-control select">
            <?php
            echo $this->Form->input('property_type_id', array(
                'options' => $properties,
                'empty' => 'All',
                'label' => 'Property Type',
                'onchange' => 'submitForm()'
            ));
            ?>
        </div>

        <div data-role="input-control" class="input-control select">
            <?php
            echo $this->Form->input('location', array(
                'options' => $province,
                'default' => 'Chiang Mai',
                'label' => 'Location',
                'onchange' => 'submitForm()'
            ));
            ?>
        </div>

        <?php
        $options = array();
        foreach ($preferences as $value => $label) {
            $options[] = array(
                'name' => $label,
                'value' => $value,
                'onClick' => 'submitForm()'
            );
        }
        ?>

        <div class="span12 no-margin checkbox">
            <label>Preference</label>
            <?php
            echo $this->Form->input('preferences', array(
                'multiple' => 'checkbox',
                'options' => $options,
                'label' => false,
            ));
            ?>
        </div>


        <?php
        $options = array();
        foreach ($bedrooms as $value => $label) {
            $options[] = array(
                'name' => $label,
                'value' => $value,
                'onClick' => 'submitForm()'
            );
        }
        ?>

        <div class="span12 no-margin">
            <label>Bedroom</label>
            <?php
            echo $this->Form->input('bedroom', array(
                'multiple' => 'checkbox',
                'options' => $options,
                'label' => false,
            ));
            ?>
        </div>

        <?php //echo $this->Form->button('Clear', array('type'=>'button','class' => 'button success width100','onclick'=>'refresh()')); ?>
        <?php echo $this->Form->end(); ?>
    </div>

    <div class="span9">
        <?php if (isset($lists) && sizeof($lists) != 0) { ?>
            <?php $i = 0; ?>
            <?php foreach ($lists as $a): ?>       
                <div class="span4 <?php echo $i % 3 == 0 ? 'no-margin' : ''; ?>">
                    <div class="list-thumb">
                        <div>
                            <h5 class="no-padding"><?php echo $a['Project']['title'] ?></h5>
                        </div>
                        <?php echo $this->Html->image($a['Project']['image_path'], array('height' => '130px', 'width' => '100%')); ?>
                    </div>
                    <div class="list-content">
                        <?php echo $a['PropertyType']['type_name_'.strtolower($a['Project']['language'])] . ', ' . $a['Project']['location'] ?>
                        <?php echo $this->Html->link('View Property', '/Projects/view/' . $a['Project']['code'], array('class' => 'price-btn', 'target' => '_blank')) ?>
                    </div>
                </div>
                <?php $i++; ?>
            <?php endforeach; ?> 
        <?php }else { ?>
            <div class="text-center margin20">
                <h5 class="c-red ">Not found project.</h5>
            </div>
        <?php } ?>
    </div>
</div>